﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InputListener : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            EventSystemManager.Instance.DispatchCE("LeftClick");
        }
        
        if (Input.GetMouseButtonDown(1))
        {
            EventSystemManager.Instance.DispatchCE("RightClick");
        }
        
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            EventSystemManager.Instance.DispatchCE("KeyCodeEscape");
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            EventSystemManager.Instance.DispatchCE("KeyCodeSpace");
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            EventSystemManager.Instance.DispatchCE("KeyCodeReturn");
        }
        
        if (Input.GetKeyDown(KeyCode.R))
        {
            EventSystemManager.Instance.DispatchCE("KeyCodeR");
        }
        
        EventSystemManager.Instance.DispatchCE("HorizontalAndVertical", Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical"));
        
        EventSystemManager.Instance.DispatchCE("MouseXY", Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
    }
}
